﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList list1 = new ArrayList() { 12,23,34,45,56};
            foreach (var arr in list1) { Console.WriteLine(arr); }
            ArrayList list2 = new ArrayList() { 123, "abc", "cba", 456 };
            int index = list2.IndexOf("abc");//查找集合数字
            if (index != -1)
            {
                Console.WriteLine("集合中存在abc");
            }
            else {
                Console.WriteLine("集合中不存在abc");
            }
            Console.WriteLine();

            ArrayList list3 = new ArrayList() { "aaa","sad",321,567};
            list2.InsertRange(1,list3);//集合添加元素
            foreach (var array in list2) { Console.WriteLine(array); }

            Console.WriteLine( );

            ArrayList list4 = new ArrayList() { "qwe","ewq","zxc"};
            list4.Sort();//排序输出
            foreach (var v in list4)
            {
                Console.WriteLine(v);

            }
        }
    }
}
